/**
 * Project Name:lf_console
 * File Name:Test.java
 * Package Name:com.lf.api.example.concurrentmap
 * Date:2016年9月24日上午11:50:24
 * Copyright (c) 2016, chenzhou1025@126.com All Rights Reserved.
 *
*/

package com.lf.api.example.concurrentmap;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentNavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;

/**
 * ClassName:Test <br/>
 * Function: TODO ADD FUNCTION. <br/>
 * Reason:	 TODO ADD REASON. <br/>
 * Date:     2016年9月24日 上午11:50:24 <br/>
 * @author   wxm
 * @version  
 * @since    JDK 1.6
 * @see 	 
 */
public class Test {
	public static void main(String[] args) {
		
		ConcurrentHashMap<String, String> map = new ConcurrentHashMap<String, String>();
    	String v1 = map.put("name", "wxm");
    	String v2 = map.put("name", "wzh");
    	String v3 = map.put("name", "wzc");
    	System.out.println("v1=" + v1 + ",v2=" + v2 + ",v3=" + v3);
    	
    	System.out.println("putIfAbsent=" + map.putIfAbsent("name", "123"));
    	System.out.println("after putIfAbsent=" + map.get("name"));
    	System.out.println(map.putIfAbsent("age", "23"));
    	System.out.println("age=" + map.get("age"));
    	
    	ConcurrentNavigableMap<Integer, String> navgableMap = new ConcurrentSkipListMap<Integer, String>();  
    	navgableMap.put(123, "one");  
    	navgableMap.put(67, "two");  
    	navgableMap.put(890, "three");  
    	ConcurrentNavigableMap<Integer, String> headMap = navgableMap.headMap(103, false); 
    	System.out.println(headMap);
    	ConcurrentNavigableMap<Integer, String> tailMap = navgableMap.tailMap(103, false); 
    	System.out.println(tailMap);
    	ConcurrentNavigableMap<Integer, String> subMap = navgableMap.subMap(67, 124); 
    	System.out.println(subMap);
	}
}

